#!/usr/bin/python

import zverinec
import unittest

class FakeOptions(object):
  def __init__(self, animal, name):
    self.animal = animal 
    self.name = name
     
  
class TestFunctions(unittest.TestCase):
  
  def testZvieraDescribe(self):
    zviera_obj = zverinec.Zviera()
    self.assertEquals('My name is None, color of my fur is None. I have None legs, None tails'
        ' and 1 heads.', zviera_obj.Describe())
    
    zviera_obj.name = 'Jojo'
    zviera_obj.fur_color = 'white'
    zviera_obj.num_legs = 4
    zviera_obj.num_tails = 1
    zviera_obj.num_heads = 1
    zviera_obj.sound = None

    self.assertEquals('My name is Jojo, color of my fur is white. I have 4 legs, 1 tails'
        ' and 1 heads.', zviera_obj.Describe())
    
  def testMakeSound(self):
    zviera_obj = zverinec.Zviera()
    self.assertEquals('Robim zvuk None', zviera_obj.MakeSound())

  def testInstantiateAndExecuteMackaFluffy(self):
    fake_options = FakeOptions('Macka', 'Fluffy')
    (describe, make_sound, specific) = zverinec.InstantiateAndExecute(fake_options)
    self.assertEquals('My name is Fluffy, color of my fur is white. I have 4 legs, 1 tails'
      ' and 1 heads.', describe)
    self.assertEquals('Robim zvuk mnaw', make_sound)
    self.assertEquals('Spim', specific)


  def testInstantiateAndExecuteMackaBlackie(self):
    fake_options = FakeOptions('Macka', 'Blackie')
    (describe, make_sound, specific) = zverinec.InstantiateAndExecute(fake_options)
    self.assertEquals('My name is Blackie, color of my fur is black. I have 4 legs, 1 tails'
      ' and 1 heads.', describe)
    self.assertEquals('Robim zvuk mnaw', make_sound)
    self.assertEquals('Spim', specific)

  def testInstantiateAndExecuteMackaIneMeno(self):
    fake_options = FakeOptions('Macka', 'Kokoska')
    self.assertRaises(NotImplementedError, zverinec.InstantiateAndExecute, fake_options)

  def testInstantiateAndExecute(self):
    fake_options = FakeOptions('Lev', 'Kokoska')
    self.assertRaises(NotImplementedError, zverinec.InstantiateAndExecute, fake_options)


  def testInstantiateAndExecutePesDunco(self):
    fake_options = FakeOptions('Pes', 'Dunco')
    (describe, make_sound, specific) = zverinec.InstantiateAndExecute(fake_options)
    self.assertEquals('My name is Dunco, color of my fur is brown. I have 4 legs, 1 tails'
      ' and 1 heads.', describe)
    self.assertEquals('Robim zvuk hav', make_sound)
    self.assertEquals('Nech sa paci', specific)

  def testInstantiateAndExecuteHadSykacka(self):
    fake_options = FakeOptions('Had', 'Sykacka')
    (describe, make_sound, specific) = zverinec.InstantiateAndExecute(fake_options)
    self.assertEquals('My name is Sykacka, color of my fur is i do not have a fur. I have None legs, None tails'
      ' and 1 heads.', describe)
    self.assertEquals('Robim zvuk sss', make_sound)
    self.assertEquals('Plazim sa', specific)


  def testInstantiateAndExecuteKohutKikirikac(self):
    fake_options = FakeOptions('Kohut', 'Kikirikac')
    (describe, make_sound, specific) = zverinec.InstantiateAndExecute(fake_options)
    self.assertEquals('My name is Kikirikac, color of my fur is perie. I have 2 legs, 1 tails'
      ' and 1 heads.', describe)
    self.assertEquals('Robim zvuk kikiriki', make_sound)
   



#  def testInstantiateAndExecutePesDunco(self):
#  fake_options = FakeOptions)'Kikirikac', 'perie')
#  (output, zviera_obj) = averinec.InstantiateAndExecute(fake_options)
#  (



#dopisat testy na vsetky ostatne zvierta - kikirikac, dunco a sykacka
# aby pre kazdeho z nich vracala spravne veci a v main-e urobim to iste co v uniottestoch 50 a 51
# 52-55 bude v main PRINT namiesto self.assertEquals print describe_str
# a vb InstantiateAndExecute zavolam zvysne funkcie Spim() pre macku
# napisat novy pseudokod - OBJEKT TYPU TUPLE kde zjednotim stringy a ten pre kukirikaca je prazdny
 

if __name__ == '__main__':
  unittest.main()
